package com.codenum.codegenerator;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
* the Yhdytceg type
*/
@SuppressWarnings("ALL")
public class Yhdytceg {


        private static volatile Yhdytceg instance;

        /**
        * 方法MethodMap
        */
        private Map<String, Method> methodMap = new HashMap<>(32);

        private Map<String, Object> saleTypeMap = new HashMap<>(64);

        public static Yhdytceg getInstance() {
            if (instance == null) {
                synchronized (Yhdytceg.class) {
                    if (instance == null) {
                        instance = new Yhdytceg();
                    }
                }
            }
            return instance;
        }


        private Yhdytceg() {

        }



    public  Boolean judgeAnjicwfmnw(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeTqdipgittr(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeClueiifjjv(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeSxxzaunsir(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeTncvofehme(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeHikpdglflc(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeFnjgugoxvv(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeZcqqktxoal(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }

    private String  anjicwfmnw;
    private String  tqdipgittr;
    private String  clueiifjjv;
    private String  sxxzaunsir;
    private String  tncvofehme;
    private String  hikpdglflc;
    private String  fnjgugoxvv;
    private String  zcqqktxoal;


    public void setAnjicwfmnw(String anjicwfmnw){
    this.anjicwfmnw = anjicwfmnw;
    }

    public String getAnjicwfmnw(){
    return this.anjicwfmnw;
    }
    public void setTqdipgittr(String tqdipgittr){
    this.tqdipgittr = tqdipgittr;
    }

    public String getTqdipgittr(){
    return this.tqdipgittr;
    }
    public void setClueiifjjv(String clueiifjjv){
    this.clueiifjjv = clueiifjjv;
    }

    public String getClueiifjjv(){
    return this.clueiifjjv;
    }
    public void setSxxzaunsir(String sxxzaunsir){
    this.sxxzaunsir = sxxzaunsir;
    }

    public String getSxxzaunsir(){
    return this.sxxzaunsir;
    }
    public void setTncvofehme(String tncvofehme){
    this.tncvofehme = tncvofehme;
    }

    public String getTncvofehme(){
    return this.tncvofehme;
    }
    public void setHikpdglflc(String hikpdglflc){
    this.hikpdglflc = hikpdglflc;
    }

    public String getHikpdglflc(){
    return this.hikpdglflc;
    }
    public void setFnjgugoxvv(String fnjgugoxvv){
    this.fnjgugoxvv = fnjgugoxvv;
    }

    public String getFnjgugoxvv(){
    return this.fnjgugoxvv;
    }
    public void setZcqqktxoal(String zcqqktxoal){
    this.zcqqktxoal = zcqqktxoal;
    }

    public String getZcqqktxoal(){
    return this.zcqqktxoal;
    }

    void setMethodMap(Map<String, Method> methodMap) {
        this.methodMap = methodMap;
    }

   void setSaleTypeMap(Map<String, Object> saleTypeMap) {
        this.saleTypeMap = saleTypeMap;
    }

    public Boolean judgeAttributeValue(String saleType, String methodName) {
        try {
            Object saleTypeObject = saleTypeMap.get(saleType);
            String targetMethod = methodName.replace("judge", "get");
            String attr = methodName.replace("judge", "");
            Method method = methodMap.get(targetMethod);
            Object invoke = method.invoke(saleTypeObject);
            return Objects.isNull(invoke) ? Boolean.FALSE : Objects.equals(invoke.toString().toLowerCase(), attr.toLowerCase());
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e.getMessage());
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e.getMessage());
        }
    }

}